#!/usr/bin/env node

import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';

const yarg = yargs(hideBin(process.argv))
  .command({
    command: 'hello [name]',
    description: '向指定的人打招呼',
    handler(argv) {
      const name = argv.name || '陌生人';
      const now = new Date()
      console.clear()
      console.log(`\n北京时间${now.getHours()}点${now.getMinutes()}分\n`)
      console.log(`Hello，${name}！`);
    }
  });

// 执行程序
yarg.parse()

// 打印帮助信息
yarg.getHelp().then((value)=>{
  console.log(value)
})